package com.chagee.store.operation.server.utils;

import cn.hutool.core.codec.Base64Decoder;
import cn.hutool.core.codec.Base64Encoder;
import org.springblade.core.tool.utils.DesUtil;

/**
 * @author: zdc
 * @date: 2024/3/11 17:43
 * @description:
 */
public class EncryptUtil {
	private EncryptUtil() {
	}

	private static String key = "chagee24";

	public static String encrypt(String ori) {
		return new String(Base64Encoder.encode(DesUtil.encrypt(ori.getBytes(), key)));
	}

	public static String decrypt(String cipher) {
		return new String(DesUtil.decrypt(Base64Decoder.decode(cipher.getBytes()), key));
	}


//	public static void main(String[] args) {
////		String key = "12345678";
////		String encStr = new String(Base64Encoder.encode(DesUtil.encrypt("我是一条字符串1992@@#！".getBytes(), key)));
////		System.out.println(encStr);
////		System.out.println("----------------");
////		System.out.println(new String(DesUtil.decrypt(Base64Decoder.decode(encStr.getBytes()), key)));
//
////		String txt = "我是一条字符串1992@@#！*()__))++==@@。！、";
////		System.out.println(txt);
////		String enc;
////		System.out.println(enc = encrypt(txt));
////		System.out.println(decrypt(enc));
//
//	}


}
